#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QtoolBar>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    // 创建一个工具栏
    QToolBar* toolBar = new QToolBar();
    this->addToolBar(toolBar);
    // 创建菜单项
    QAction* action1 = new QAction("打开");
    QAction* action2 = new QAction("保存");
    toolBar->addAction(action1);
    toolBar->addAction(action2);

    // 给菜单项设置图标
    action1->setIcon(QIcon(":/open.png"));
    action2->setIcon(QIcon(":/save.png"));

}

MainWindow::~MainWindow()
{
    delete ui;
}

